(function(){"use strict";BX.namespace("BX.Landing.UI.Panel");var t=BX.Landing.UI.Button.SidebarButton;BX.Landing.UI.Panel.ContentEdit=function(t,n){BX.Landing.UI.Panel.Content.apply(this,arguments);this.layout.classList.add("landing-ui-panel-content-edit");this.appendFooterButton(new BX.Landing.UI.Button.BaseButton("save_block_content",{text:BX.Landing.Loc.getMessage("BLOCK_SAVE"),onClick:BX.Type.isFunction(n.onSaveHandler)?n.onSaveHandler:()=>{},className:"landing-ui-button-content-save",attrs:{title:BX.Landing.Loc.getMessage("LANDING_TITLE_OF_SLIDER_SAVE")}}));this.appendFooterButton(new BX.Landing.UI.Button.BaseButton("cancel_block_content",{text:BX.Landing.Loc.getMessage("BLOCK_CANCEL"),onClick:BX.Type.isFunction(n.onCancelHandler)?n.onCancelHandler:()=>{},className:"landing-ui-button-content-cancel",attrs:{title:BX.Landing.Loc.getMessage("LANDING_TITLE_OF_SLIDER_CANCEL")}}))};BX.Landing.UI.Panel.ContentEdit.showedPanel=null;BX.Landing.UI.Panel.ContentEdit.prototype={constructor:BX.Landing.UI.Panel.ContentEdit,__proto__:BX.Landing.UI.Panel.Content.prototype,show:function(){BX.Landing.UI.Panel.ContentEdit.showedPanel=this;if(BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){BX.Landing.UI.Panel.StylePanel.getInstance().hide().then(function(){BX.Landing.UI.Panel.Content.prototype.show.call(this)}.bind(this))}else{BX.Landing.UI.Panel.Content.prototype.show.call(this)}},appendForm:function(n){this.forms.add(n);this.content.appendChild(n.getNode());this.checkReadyToSave();if(n.title){var e=new t(n.code,{text:n.title,empty:!n.fields.length,onClick:function(){this.scrollTo(n.layout);this.highlightItem(n.layout)}.bind(this)});this.sidebarButtons.add(e);this.sidebar.appendChild(e.layout)}n.fields.forEach((function(n){if(n.title){var e=new t(n.selector,{text:n.title,child:true,onClick:function(t){t.preventDefault();t.stopPropagation();this.scrollTo(n.layout);this.highlightItem(n.layout)}.bind(this)});this.sidebarButtons.add(e);this.sidebar.appendChild(e.layout)}}),this)},replaceForm:function(n,e){this.forms.remove(n);this.forms.add(e);this.checkReadyToSave();BX.replace(n.getNode(),e.getNode());var i=this.sidebarButtons.get(n.code);if(i){var a=new t(e.code,{text:e.title,empty:e.type==="dynamicCards"||!e.fields.length,onClick:function(){this.scrollTo(e.layout)}.bind(this)});BX.replace(i.layout,a.layout);this.sidebarButtons.remove(i);this.sidebarButtons.add(a)}},compact:function(t){this.layout.classList[t?"add":"remove"]("landing-ui-panel-content-edit-compact")},highlightItem:function(t){var n="landing-ui-panel-highlight";this.removeHighlights(this.layout,n);BX.Dom.addClass(t,n);setTimeout((()=>{BX.Dom.removeClass(t,n)}),1500)},removeHighlights:function(t,n){var e=t.querySelectorAll("."+n);if(e.length>=1){e.forEach((function(t){BX.Dom.removeClass(t,n)}))}}}})();
//# sourceMappingURL=edit_content_panel.map.js